package com.example.softdemo.serviceImpl;

import com.example.softdemo.mapper.UserMapper;
import com.example.softdemo.pojo.User;
import com.example.softdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 李琦 on 2021/11/8.
 * @version java version "1.8.0_301" 2021-04-20
 */
//业务层实现类
@Service
public class UserServiceImpl implements UserService {

    //将持久层对象注入到业务层中
    @Autowired(required = false)
    private UserMapper useraMapper;

    @Override
    public User findUserById(Integer id) {
        User user=useraMapper.selectUserInfoById(id);
        return null;
    }

    @Override
    public List<User> findUserList() {
        List<User> list=useraMapper.findUsers();
        return list;
    }

    @Override
    public void deleteUserinfoById(Integer id) {
        //在业务层中使用持久层对象调用持久层方法
         useraMapper.deleteUserById(id);//返回值没啥用,不需要返回,直接void
    }


}










